package com.msh.artascope.devcloud.client.qo;

import com.msh.artascope.interfaces.ILoginAccount;
import com.msh.frame.client.base.BaseProperties;
import com.msh.frame.client.base.BaseQo;
import com.msh.frame.client.validation.IListVo;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Collection;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import lombok.experimental.Accessors;


/**
 * @author shihu
 * @mail m-sh@qq.com
 */
@Data
@Accessors(chain = true)
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Schema(name = "构建记录Qo")
public class ModuleBuildQo extends BaseQo<ModuleBuildQo> {
  @Schema(name = "主键")
  private Long id;

  @Schema(name = "ID大于")
  private Long idGt;

  @Schema(name = "项目Id")
  private Long projectId;

  @Schema(name = "in查询项目Id")
  private Collection<Long> projectIdIn;

  @Schema(name = "模块Id")
  private Long moduleId;

  @Schema(name = "in查询模块Id")
  private Collection<Long> moduleIdIn;

  @Schema(name = "分支")
  private String branch;

  @Schema(name = "pipeline名称")
  private String pipelineName;

  @Schema(name = "maven 参数")
  private String commandParam;

  @Schema(name = "jenkins构建号")
  private Integer buildNum;

  @Schema(name = "镜像名称")
  private String imageName;

  @Schema(name = "构建结果")
  private String result;

  @Schema(name = "运行状态")
  private Integer runningFlag;

  @Schema(name = "运行状态in查询")
  private Collection<Integer> runningFlagIn;

  @Schema(name = "租户")
  private Long tenantId;

  @Schema(name = "创建人id")
  private Long createrId;

  @Schema(name = "创建人名")
  private String createrName;

  @Min(groups = {IListVo.class}, value = 1, message = "currentPage从1开始")
  @Schema(name = "当前页数")
  protected Integer currentPage = 1;

  @Min(groups = {IListVo.class}, value = 1, message = "pageSize最少返回1条")
  @Max(groups = {IListVo.class}, value = 10000, message = "pageSize最多返回10000条")
  @Schema(name = "每页返回数量")
  protected Integer pageSize = BaseProperties.MAX_PAGE_SIZE;


  public void initLoginAccount(ILoginAccount loginAccount){
    this.tenantId = loginAccount.getTenantId();
  }


}